package com.boang.exception;

/*
    @author:sa
    @date:2024/11/25 9:55
*/
public class ExceptionDemo02 {
    public static void main(String[] args) throws FuException {
        int[] ints = new int[3];
        m1(ints, -1);
        System.out.println("A");
    }

    public static void m1(int[] ints, int index) throws FuException {
        if (ints == null) {
            throw new NullPointerException("不能穿空对象");
        }
        if (index < 0) {
            throw new FuException("不能为负数");
        }
        if (index > ints.length) {
            throw new ArrayIndexOutOfBoundsException("下标越界，不能方法");
        }
        System.out.println(ints[index]);
    }
}